
import sys
import socket
global sock

def connect_UDP():
    UDP_IP="127.0.0.1"
    UDP_PORT=5055

    sock = socket.socket( socket.AF_INET, # Internet
                      socket.SOCK_DGRAM ) # UDP
    
          
    sock.bind( (UDP_IP,UDP_PORT) )

def recieve_data():
 
       # data_rec.config(text=data)
    # calls itself every 200 milliseconds
    # to update the time display as needed
    # could use >200 ms, but display gets jerky
    while True:
        data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
        print "received message:", data
      
        if data=="quit":       
            print "quittin"
            print data
            sock.close()
            sys.exit
        else:
            print "continue"
            print data
            time2 = time.strftime('%H:%M:%S')
    return data         

def close_socket():
    sock.close

  
    
    # get the current local time from the PC

        
